import request from '@/utils/request'
import { getToken } from '@/utils/auth'

export function addPermission(res) {
  return request({
    url: '/api/admin/AddPermission',
    method: 'post',
    params: res,
    headers: {
      Token: getToken()
    }
  })
}
export function getPermission(val, total, page, limit) {
  return request({
    url: '/api/admin/GetPermission',
    method: 'get',
    params: { 'val': val, 'total': total, 'page': page, 'limit': limit },
    headers: {
      Token: getToken()
    }
  })
}
export function updatePermission(res) {
  return request({
    url: '/api/admin/UpdatePermission',
    method: 'post',
    params: { 'res': res },
    headers: {
      Token: getToken()
    }
  })
}
export function deletePermission(id) {
  return request({
    url: '/api/admin/DelPermission',
    method: 'get',
    params: { 'id': id },
    headers: {
      Token: getToken()
    }
  })
}
export function CheckPermissionShow(status, id) {
  return request({
    url: '/api/admin/CheckPermissionShow',
    method: 'get',
    params: { 'status': status, 'id': id },
    headers: {
      Token: getToken()
    }
  })
}

export function CheckPermissionStatus(status, id) {
  return request({
    url: '/api/admin/CheckPermissionStatus',
    method: 'get',
    params: { 'status': status, 'id': id },
    headers: {
      Token: getToken()
    }
  })
}

export function getPermissionOption() {
  return request({
    url: '/api/admin/getPermissionOption',
    headers: {
      Token: getToken()
    },
    method: 'get'
  })
}
